/*
 * Copyright (C) 2021 The Chinese Software International Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.zyyoona7.picker;

import com.zyyoona7.wheel.IWheelEntity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * City类
 *
 * @author zyyoona7
 * @version v1.0.0
 * @since 2018-08-20
 */
public class CityEntity implements IWheelEntity, Serializable {
    /**
     * 国家
     */
    public static final String LEVEL_COUNTRY = "country";
    /**
     * 省
     */
    public static final String LEVEL_PROVINCE = "province";
    /**
     * 市
     */
    public static final String LEVEL_CITY = "city";
    /**
     * 区
     */
    public static final String LEVEL_DISTRICT = "district";

    private String citycode;
    private String adcode;
    private String name;
    private String center;
    private String level;
    private List<CityEntity> districts;

    /**
     * getCitycode
     *
     * @return 编码
     */
    public String getCitycode() {
        return citycode;
    }

    /**
     * setCitycode
     *
     * @param citycode
     */
    public void setCitycode(String citycode) {
        this.citycode = citycode;
    }

    /**
     * getAdcode
     *
     * @return 编码
     */
    public String getAdcode() {
        return adcode;
    }

    /**
     * setAdcode
     *
     * @param adcode
     */
    public void setAdcode(String adcode) {
        this.adcode = adcode;
    }

    /**
     * getName
     *
     * @return 名称
     */
    public String getName() {
        return name == null ? "" : name;
    }

    /**
     * setName
     *
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * getCenter
     *
     * @return 居中
     */
    public String getCenter() {
        return center;
    }

    /**
     * setCenter
     *
     * @param center
     */
    public void setCenter(String center) {
        this.center = center;
    }

    /**
     * getLevel
     *
     * @return 等级
     */
    public String getLevel() {
        return level;
    }

    /**
     * setLevel
     *
     * @param level
     */
    public void setLevel(String level) {
        this.level = level;
    }

    /**
     * getDistricts
     *
     * @return List<CityEntity>
     */
    public List<CityEntity> getDistricts() {
        return districts == null ? new ArrayList<CityEntity>(1) : districts;
    }

    /**
     * setDistricts
     *
     * @param districts
     */
    public void setDistricts(List<CityEntity> districts) {
        this.districts = districts;
    }

    /**
     * 打印
     *
     * @return String
     */
    @Override
    public String toString() {
        return "CityEntity{"
                + "citycode='" + citycode + '\''
                + ", adcode='" + adcode + '\''
                + ", name='" + name + '\''
                + ", center='" + center + '\''
                + ", level='" + level + '\''
                + ", districts=" + districts
                + '}';
    }

    /**
     * 重点：重写此方法，返回 WheelView 显示的文字
     *
     * @return 显示的文字
     */
    @Override
    public String getWheelText() {
        return name == null ? "" : name;
    }
}
